package com.quick.controller;

import com.quick.annotation.IgnoreToken;
import com.quick.base.Page;
import com.quick.shop.doamin.vo.ShopGoodsViewVo;
import com.quick.shop.doamin.vo.ShopGoodsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.quick.shop.doamin.search.ShopGoodsSearch;
import com.quick.base.Search;
import com.quick.service.IShopGoodsService;

@RestController
@Api(tags = "商品管理")
@RequestMapping("api/shop/goods")
public class ShopGoodsController {
	
	@Autowired
	private IShopGoodsService shopGoodsService;
	
	@PostMapping("search")
	@ApiOperation("分页商品")
	@IgnoreToken
	public Page<ShopGoodsVo> search(@RequestBody Search<ShopGoodsSearch> search){
		return shopGoodsService.search(search);
	}
	
	@GetMapping("queryId/{id}")
	@ApiOperation("分页商品信息")
	@IgnoreToken
	public ShopGoodsViewVo queryId(@PathVariable("id") Long id){
		return shopGoodsService.queryId(id);
	}

}
